/**
 * 
 * @author  phoenics@126.com
 * @version v.0.1
 * @date  2018年3月14日 下午2:13:45 
 * 
 */
package phoenics.upservice.repository;

import java.util.Optional;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import phoenics.upservice.entity.User;

/**
 *
 */
//@CacheConfig(cacheNames = "users")
public interface UserRepo  extends JpaRepository<User, Long> {  
	@Query("select u from User u where u.mobile=?1")  
	@Cacheable(value="users",key="#mobile+'findMobileCached'")
	Optional<User> findMobileCached(String mobile);  
    Optional<User> findByMobile(String mobile);  
}
